﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lsk.Data;
using System.Data.Entity.Core.Objects;
using Lsk.Business.DTO;

namespace Lsk.Business
{
    public class UsefulInfo
    {
        private lskEntities _entity;

        public UsefulInfo()
        {
            _entity = new lskEntities();
        }


        public IEnumerable<GetUsefulInfo_Result> GetUsefulInfo()
        {
            ObjectResult<GetUsefulInfo_Result> news = _entity.GetUsefulInfo(0);
            return news.AsEnumerable<GetUsefulInfo_Result>();
        }

        public UsefulInfoMessage GetUsefulInfo(string guid)
        {
            UsefulInfoMessage response = new UsefulInfoMessage();
            Mobile_UsefulInfo data = (from a in _entity.Mobile_UsefulInfo where a.InfoId == new Guid(guid) select a).FirstOrDefault();
            response.UsefulInfo = data;
            response.pictureList = _entity.GetPictureByID(guid);
            return response;

        }
    }
}
